#ifndef HomeSensorNet_h
#define HomeSensorNet_h

#include "Arduino.h"
#include "IPAddress.h"
#include "EthernetClient.h"
#include "EthernetServer.h"
#include <EthernetUdp.h>

#if UDP_TX_PACKET_MAX_SIZE <64 
#error : UDP packet size to small - modify EthernetUdp.h to set buffers to 128 bytes
#endif


//Set up sensor types according to protocol spec
#define UNKNOWN 0
#define TEMPERATURE 1
#define BAROMETRIC 2
#define HUMIDITY 3
#define WATTAGE 4
////Define rest of sensor types later

class HomeSensorNet_class
{
  public:
    HomeSensorNet_class();
    void begin(EthernetUDP* udp, IPAddress local_ip, byte stationID);
    void beginTransmission();
    void endTransmission();
    
    void sendSensor (byte SensorID, byte SensorType, int Value);
    void sendSensor (byte SensorID, byte SensorType, long int Value);
    void sendSensor (byte SensorID, byte SensorType, byte Value);
    
  private:
    EthernetUDP* _udp ; 
    IPAddress _broadcast;
    byte _stationID;
    unsigned long _stationTime;
};

extern HomeSensorNet_class HomeSensorNet;

#endif
